import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { BaseItem } from "../common/BaseItem";
import { ObjCreate } from "../common/ObjCreate";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { ItemData } from "../../resource/info/ItemData";
import { EffectManager } from "../../manager/EffectManager";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { GButton } from "../../../../com/mui/controls/GButton";
type int = number;
//class FeedMemoryCellRenderer
    
    export  class FeedMemoryCellRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            this._baseItem = new BaseItem();
            this._baseItem.isDragAble = false;
            this._baseItem.isDropAble = false;
            this._baseItem.isShowLock = true;
            this._baseItem.setSize(32, 32);
            this._baseItem.move(3, 6);
            this.addChild(this._baseItem);
            this._closeBtn = ObjCreate.createGButton("", 25, 0, 14, 14, null, "LittleCloseBtn");
            this._closeBtn.focusEnabled = true;
            this._closeBtn.configEventListener(flash.events.MouseEvent.CLICK, this.closeBtnClickHandler);
            this.addChild(this._closeBtn);
            return;
        }

        /* internal  */closeBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FeedMemoryCancelItem, this._itemData.itemCode));
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            this._itemData = new ItemData(arg1.code);
            if (this._itemData) 
            {
                this._baseItem.itemData = this._itemData;
                this._closeBtn.visible = true;
                this.shine(arg1.flag);
            }
            else 
            {
                this._baseItem.itemData = null;
                this._closeBtn.visible = false;
                this.shine(0);
            }
            return;
        }

        /* internal  */shine(arg1: int): void
        {
            if (arg1 != 1) 
            {
                EffectManager.glowFilterUnReg(this._baseItem);
            }
            else 
            {
                EffectManager.glowFilterReg(this._baseItem, [FilterConst.guideTipsFilter], 0.6, 15, 5, 0);
            }
            return;
        }

        /* internal */ /* var */_baseItem: BaseItem;

        /* internal */ /* var */_itemData: ItemData;

        protected /* var */_closeBtn: GButton;
    }
